const express = require('express');
const router = express.Router();
const chatController = require('../controllers/chatController');
const authMiddleware = require('../middleware/authMiddleware');

// 应用身份验证中间件
router.use(authMiddleware);

// 获取好友列表
router.get('/friends', chatController.getFriends);

// 获取与特定好友的聊天记录
router.get('/messages/:friendId', chatController.getMessagesByFriendId);

// 标记消息为已读
router.put('/messages/read', chatController.markMessagesAsRead);

// 发送消息
router.post('/messages', chatController.sendMessage);

module.exports = router;